package Day21;

import java.util.Scanner;

/**
 * Creat with IntelliJ IDEA
 * Description
 * User: mamba24
 * Date: 2022-10-12
 * Time: 19:26
 * To BE A Better Person-2020-3-2
 */
public class Day21 {
    private static void printCard(int[] card){
        for (int i = 0; i < card.length; i++) {
            System.out.print(card[i]);
            if (i< card.length-1){
                System.out.print(" ");
            }
        }
    }

    private static void TakeCard(int[] right,int[] left,int[] card){
        for (int i = 0; i < card.length; i++) {
            if(i> (card.length/2)-1){
                right[i- (card.length/2)]=card[i];
            }else{
                left[i]=card[i];
            }
        }
    }
    private static void shuff(int[] card){
        int[] left=new int[card.length/2];
        int[] right=new int[card.length/2];
        //左右手开始拿牌
        TakeCard(right,left,card);
        //开始放牌
        for (int i = right.length-1; i >= 0 ; i--) {
            card[2*i+1]=right[i];
            card[2*i]=left[i];
        }
    }
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int time=sc.nextInt();
        while(time>0){
            //开始拿牌
            //牌数
            int n=sc.nextInt();
            //洗几次
            int k=sc.nextInt();
            int[] card=new int[2*n];
            //抓牌
            for (int i = 0; i < 2*n; i++) {
                card[i]=sc.nextInt();
            }
            //开始洗牌
            while(k>0){
                shuff(card);

                k--;
            }
            //输出牌
            printCard(card);
            System.out.println();
            //洗牌结束
            time--;
        }
    }
}
